bin=httpserver
src=main.cc
cgi=cgi_bin
cgiother=python_cgi.py,shell_cgi.sh
cc=g++
FLAGS=-std=c++11 -lpthread #-DDEBUG1
pwd=$(shell pwd)

.PHONY:all
all:$(cgi) $(bin)

$(cgi):$(pwd)/Cgi/cgi_bin.cc
	$(cc) -o $@ $^ $(FLAGS)

$(bin):$(src)
	$(cc) -o $@ $^ $(FLAGS)


.PHONY:Output
output:
	mkdir -p Output
	mkdir -p Output/Web
	cp -r $(cgi) $(pwd)/Web 
	cp -r $(pwd)/Cgi/{$(cgiother)} $(pwd)/Web 
	cp -r $(pwd)/Web $(pwd)/Output
	cp -r $(bin) $(pwd)/Output
.PHONY:clean
clean:
	rm -rf *.o $(bin) Output $(pwd)/$(cgi)

